package com.itnoob.handler.impl;

import com.itnoob.domain.Article;
import com.itnoob.handler.ReviewHandler;
import com.itnoob.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;

/**
 * @author zhoujun
 * @date 2025/3/18 21:11
 */
//@Primary   //这个责任链使用这个来调整顺序,不太灵活啊
@Component("BASE")
public class BaseReviewHandler implements ReviewHandler {

    @Autowired
    private SensitiveWordReviewHandler sensitiveWordReviewHandler;

    @Override
    public Result review(Article article) {
        //进行基础审核,检查字数是否达标


        int wordCount  = article.getContent().split("\\s+").length;
        if (wordCount <= 100){
            return  new Result(true,"字数满足规则");
        }else {
            return new Result(false,"字数违规");
        }
    }
}
